#region MIT Licence
/*
 * Copyright (C) 2014 PdfCreative
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
 * and associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom 
 * the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included 
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#endregion

using System;
using System.Collections.Generic;
using System.Text;

namespace PdfCreative.Pdf.Writer
{
    /// <summary>
    /// The PdfPage class incapsulates a page object in a PDF document together with references to associated objects such as the
    /// page's contents and its resources.
    /// </summary>
    public class PdfPage : ICloneable
    {
        // Private fields
        // ==============
        #region Private fields
        private PdfObjectReference _contentsReference;
        private PdfRectangle _mediaBox;
        private PdfObjectReference _pageReference;
        private PdfObjectReference _resourcesReference;
        #endregion



        // Implementation interface
        // ========================
        #region ICloneable Members
        /// <summary>
        /// Returns a clone of the PdfPage.
        /// </summary>
        /// <returns>A reference to the clone.</returns>
        public object Clone()
        {
            return new PdfPage(_mediaBox, _pageReference, _resourcesReference, _contentsReference);
        }
        #endregion



        // Public properties
        // =================
        #region Public properties
        /// <summary>
        /// Retrieves a reference to the object that represents the page's contents.
        /// </summary>
        public PdfObjectReference ContentsReference
        {
            get { return _contentsReference; }
        }

        /// <summary>
        /// Retrieves the media box of this page.
        /// </summary>
        public PdfRectangle MediaBox
        {
            get { return _mediaBox; }
        }

        /// <summary>
        /// Retrieves a reference to the object that represents the page.
        /// </summary>
        public PdfObjectReference PageReference
        {
            get { return _pageReference; }
        }

        /// <summary>
        /// Retrieves a reference to the object that represents the page's resources.
        /// </summary>
        public PdfObjectReference ResourcesReference
        {
            get { return _resourcesReference; }
        }

        #endregion



        // Public constructor
        // ==================
        #region Public constructor
        /// <summary>
        /// Constructs a new PdfPage instance.
        /// </summary>
        /// <param name="mediaBox">The media box (page size) of the page</param>
        /// <param name="pageReference">The object reference that represents the page in the PDF document stream</param>
        /// <param name="resourcesReference">References to the page's resource object</param>
        /// <param name="contentsReference">Reference to the page's contents object</param>
        public PdfPage(
            PdfRectangle mediaBox,
            PdfObjectReference pageReference, 
            PdfObjectReference resourcesReference, 
            PdfObjectReference contentsReference)
        {
            _mediaBox = mediaBox;
            _pageReference = pageReference;
            _resourcesReference = resourcesReference;
            _contentsReference = contentsReference;
        }
        #endregion

    } // PdfPage class
}
